package top.haijunit.springboot.bucket.springsecurity02.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.context.MessageSource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;

/**
 * @Author 百旺张
 * @Date 2021/11/11
 * @Description
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/")
public class DemoController {

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/demo")
    @PreAuthorize("hasRole('ROLE_DEMO')")
    public String demo() {
        return "DEMO";
    }

}
